<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="享受生活 | 追求梦想 | 自由快乐 | xiaohello.cn ">
	<meta name="author" content="xiaohello.cn">
    <link rel="icon" href="/images/favicon.ico">

    <title>{% block title %} {% endblock %} - 追求生活，追求梦想</title>

    <!-- Custom styles for this template -->
    <link href="/css/blog.css" rel="stylesheet">
    
    <!-- Bootstrap core CSS -->
    <link href="/css/bootstrap.min.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

    <div class="blog-masthead">
      <div class="container">
        <nav class="blog-nav">
        <ul class="nav navbar-nav">
          <li><a class="blog-nav-item" href="/">首页</a></li>
          <li><a class="blog-nav-item" href="/">博客</a></li>
          <li><a class="blog-nav-item" href="#">图库</a></li>
          <li><a class="blog-nav-item" href="#">关于</a></li>
        </ul>
          <form class="navbar-form navbar-right" method="get" action="/search/">
            <input type="text" name="keyword" class="form-control" placeholder="Search...">
          </form>
        </nav>
      </div>

    </div>

    <div class="container">

      <div class="blog-header">
      {% block header %} {% endblock %}
      </div>

      <div class="row">

        <div class="col-sm-8 blog-main">
			{% block content %} {% endblock %}
        </div><!-- /.blog-main -->

        <div class="col-sm-3 col-sm-offset-1 blog-sidebar">
          <div class="sidebar-module sidebar-module-inset">
            <h3>关于</h3>
            <p style="text-align: center"><img src="/images/about-us.png" class="img-circle" /></p>
            <p>本站内容均为本人随意敲击键盘所出，用于检验本人电脑性能，本人亦看不懂是什么意思。亦不代表本人局部或全部同意、支持或者反对以上任何内容。</p>
          </div>
          <div class="sidebar-module">
            <h3>存档</h3>
            <ol class="list-unstyled" id="guidang">
              <li><a href="#">March 2014</a></li>
              <li><a href="#">February 2014</a></li>
              <li><a href="#">January 2014</a></li>
            </ol>
          </div>
          <div class="sidebar-module">
            <h3>分组</h3>
            <ol class="list-unstyled" id="fenzu">
              <li><a href="#">March 2014</a></li>
              <li><a href="#">February 2014</a></li>
              <li><a href="#">January 2014</a></li>
            </ol>
          </div>
          <div class="sidebar-module">
            <h3>链接</h3>
            <ol class="list-unstyled">
              <li><a target="_blank" href="http://git.oschina.net/qiuye001/PyBlog" title="本站源码">Git@OSC</a></li>
              <li><a target="_blank" href="http://weibo.com/qiuye001" title="秋野001的微博">Weibo</a></li>
              {% if user.is_authenticated %}
			  <li><a href="/edit" title="控制台">控制台</a></li>
			  <li><a href="/logout" title="登出">登出</a></li>
			  {% else %}
			  <li><a href="/login.html" title="登陆">登陆</a></li>
			  {% endif %}
            </ol>
          </div>
        </div><!-- /.blog-sidebar -->

      </div><!-- /.row -->

    </div><!-- /.container -->

    <div class="blog-footer">
      <p>
      &copy; 2014 <a target="_blank" href="http://wxxiaohello.sinaapp.com/">XIAOHELLO.CN</a> 版权所有
					<!-- 页脚加入sae推广图标 -->
					|
					<a href="http://sae.sina.com.cn/" target="_blank"> 
						<img style="scrollbar-arrow-color: buttontext; vertical-align: middle;"
						src="http://sae.sina.com.cn/doc/_images/poweredby-117x12px.gif">
					</a></p>
      <p>
        <a href="#">Back to top</a>
      </p>
    </div>


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/jquery.goup.js"></script>
    <script type="text/javascript">
	$(document).ready(function() {
		//返回顶部按钮
		$.goup({
			trigger : 100,
			bottomOffset : 50,
			locationOffset : 50,
			title : '返回顶部',
			titleAsText : false
		});
		//获取侧边栏信息
		$.get("/sidebar/",function (data) { 
			var data = (eval(data));
			group_list(data[0].group);
			filing_list(data[0].filing);
		});
	});
	//显示归档列表
	function filing_list(data){
		var html ="";
		var MAXID = 15
		for (var i=0 ;i<data.length;i++){
			var month = data[i].month.replace(/-/, "/")
			if(i>(MAXID-1)){
				html += "<li class='sidebar-guidang_active'><a href='/filing/"+month+"/' title='"+data[i].month+"'> "+data[i].month+" ("+data[i].count+") "+"</a></li>";
			}else{
				html += "<li><a href='/filing/"+month+"/' title='"+data[i].month+"'> "+data[i].month+" ("+data[i].count+") "+"</a></li>";
			}
		}
		if(data.length>(MAXID)){
			html+="<li><img style='border:0;float:none;cursor:pointer;'src='/images/down15.png' title='展开' onclick='_show_(this)'></li>";
		}
		$("#guidang").html(html);
	}
	//显示分组列表
	function group_list(data){
		var html ="";
		for (var i=0 ;i<data.length;i++){
			var group = data[i];
			html += "<li><a href='/group/"+group.id+"/' title='"+group.content+"'> "+group.content+" ("+group.count+") "+"</a></li>";
		}
		$("#fenzu").html(html);
	}
	
	//展开和收起按钮
	function _show_(obj){
			$(".sidebar-guidang_active").show("slow");	
			obj.setAttribute("src","/images/up15.png");
			obj.setAttribute("onclick","_hide_(this)");
			obj.setAttribute("title","收起");
	}
	
	function _hide_(obj){
		$(".sidebar-guidang_active").hide("slow");	
		obj.setAttribute("src","/images/down15.png");
		obj.setAttribute("onclick","_show_(this)");
		obj.setAttribute("title","展开");
}
    </script>
  </body>
</html>
